import Vue from 'vue';
import vuex from 'vuex';

// Vue.use(vuex);

//方法名
const INCREMENT = "increment";

/**
 * 6、父子组件调用vuex管理的状态太麻烦了
 *  现在用map
 */
export default new vuex.Store({
  actions: {
    _increment: ({commit}) => {
      commit(INCREMENT);
    }
  },
  modules: {
    component001: {
      state: {
        count: 20
      },
      mutations: {
        [INCREMENT](state) {
          state.count++
        }
      },
      getters: {
        myshow: (state) => {
          return state.count;
        }
      }
    }
  },
})
